<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="no" standalone="yes" indent="yes"/>

<xsl:template match="proto">
<div>
proto
</div>
<xsl:apply-templates select="field"/>
</xsl:template>

<xsl:template match="field">
<xsl:choose>
<xsl:when test="*">
<div>
child_begin
<xsl:apply-templates select="field"/>
child_end
</div>
</xsl:when>
<xsl:otherwise>
no_child
</xsl:otherwise>
</xsl:choose>

</xsl:template>


<xsl:template match="/">
<div>
root
</div>
<xsl:apply-templates select="proto"/> 
</xsl:template>
</xsl:stylesheet>